<!doctype html>
<html>
<head>
    <title>关键词添加</title>
    <?php $this->load->module('admin/index/page_header');?>
    <!--引入CSS-->
    <link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/public/Lib/webuploader/webuploader.css">
    <!--引入JS-->
    <script type="text/javascript" src="<?php echo URLPRE;?>static/public/Lib/webuploader/webuploader.js"></script>
</head>
<body>
<div class="wrap">
    <div class="nav">
        <ul>

             <li>
                <a  href="<?php echo site_url('weixin/wresponse/response_text_list')?>">响应消息列表</a>
            </li>
            <li>
                <a  href="<?php echo site_url('weixin/wresponse/keywords_list')?>">关键词列表</a>
            </li>

             <li class="current">
                 <?php if($id):?>
                     <a href="javascript:;" class="current">关键词编辑</a>
                 <?php else:?>
                     <a class="icon-plus"  href="javascript:;" class="current">关键词添加</a>
                 <?php endif;?>
            </li>

        </ul>
    </div>
    <div id="home_toptip"></div>
    <div class="table_full">
    <form class="formvalidate" action="<?php echo $form_url;?>" method="post">
    <div class="table_full">
        <table width="100%">
            <col class="th" />
            <col/>
            <thead>
            </thead>
            <tr>
                <th>关键词</th>
                 <td>
                    <input type="text" class="input length_5"  name="Form[keywords]" placeholder="填写关键词"  size="50" value="<?php echo  $keywords;?>" validate="{required:true,rangelength:[1,20]}" />
                </td>
            </tr>
            <tr>
                <th>关键词类型</th>
                <td class="rowform">
                    <ul>
                        <li>
                            <label><input class="js-check" type="radio" value="1" name="Form[type]" <?php if((isset($type)&&$type=='1')||!$id):?>checked="checked"<?php endif;?> />自定义网址</label>
                        </li>
                        <li>
                            <label><input class="js-check" type="radio" value="2" name="Form[type]"  <?php if(isset($type)&&$type=='2'):?>checked="checked"<?php endif;?>/>线路</label>
                        </li>
                    </ul>
                </td>
                <td class="field"></td>
            </tr>
            <tr class="js-line">
                <th>内容</th>
                <td>
                    <textarea class="text-input textarea" name="Form[content]" rows="6" cols="60" validate="{required:true}" placeholder="填写线路编号，用逗号或空格隔开"><?php if($type=='2') echo $content;?></textarea><span class="red" style="display:block">填写线路编号，用逗号或空格隔开</span>
                </td>
            </tr>

            <tr class="js-custom-url">
                <th>自定义网址标题</th>
                 <td>
                    <input type="text" class="input length_5"  name="Form[title]" size="50" placeholder="自定义网址标题"  value="<?php echo  $url;?>" validate="{required:true,rangelength:[1,200]}" />
                </td>
            </tr>

            <tr class="js-custom-url">
                <th>自定义网址图片</th>
                 <td class="rowform">
                      <ul>
                        <li><input type="text" class="input rounded" style="width: 300px;" name="Form[pic]" id="file_url" validate="{required:true}" value="<?php echo $pic;?>"/></li>
                        <li><div id="filePicker">选择图片</div></li>
                        <?php if($pic):?>
                          <li><div class="webuploader-pick view_pic" data-uri="<?php echo URLPIC.$pic;?>" title="查看图片">查看图片</div></li>
                        <?php endif;?>
                      </ul>

                </td>
            </tr>
            <tr class="js-custom-url">
                <th>自定义网址描述</th>
                 <td>
                    <input type="text" class="input length_5"  name="Form[description]" size="50" value="<?php echo  $description;?>" />
                </td>
            </tr>
            <tr class="js-custom-url">
                <th>自定义网址</th>
                 <td>
                    <input type="text" class="input length_5"  name="Form[url]" size="50" placeholder="填写网址"  value="<?php echo  $url;?>" validate="{required:true,rangelength:[1,200]}" />
                </td>
            </tr>
        </table>
    </div>

    <div class="btn_wrap">
        <div class="btn_wrap_pd">
            <button type="submit" class="btn btn_submit J_ajax_submit_btn">提交</button>
        </div>
    </div>
     <input type="hidden" name="id" value="<?php echo $id ;?>"/>
    </form>
    </div>
</div>
<script type="text/javascript">
<?php if(!$id):?>
$(function(){
    $('.js-custom-url').show();
    $('.js-line').hide();
    $('.js-check').click(function(){
        var check = $(this).val();
        $('.js-custom-url').show();
        $('.js-line').hide();
        if(check=='2')
        {
            $('.js-custom-url').hide();
            $('.js-line').show();
        }
    })
})
<?php else:?>
$(function(){
    <?php if($type=='1'):?>
    $('.table_full').find(".js-check:eq(1)").closest('li').remove();
    $('.js-custom-url').show();
    $('.js-line').hide();
    <?php else:?>
    $('.table_full').find(".js-check:eq(0)").closest('li').remove();
    $('.js-custom-url').hide();
    $('.js-line').show();
    <?php endif;?>
})
<?php endif;?>

    //图片上传
    upload_image("<?php echo site_url('admin/upload/ajax_upload');?>",'filePicker','file_url');
</script>
</body>
</html>